<?php session_start();
 include 'functions.php';
 $member_id = $_SESSION['member_id'];
 if(isset($_POST['confID'])) {
 $confID = $_POST['confID'];
//get the authors for a given conference
    $query1 = "SELECT M.first_name, M.last_name, M.member_id
          FROM member M INNER JOIN member_privileges MP
          ON M.member_id = MP.member_id
          INNER JOIN privileges Pr
          ON MP.privileges_id = Pr.privileges_id
          WHERE MP.conference_id = {$confID}
          AND Pr.role = 'author'
          AND M.member_id <> {$member_id}";
//get the reviewers of a given conference    
//populates the authors table with authors of this conference
   
    $authors = mysql_query($query1) or die(mysql_error());
    if(mysql_num_rows($authors) == 0) {
        echo '<p align="center">No auhtors found in this conference</p>';
    } else {
    if ($authors) {
       echo "<table id='Authors'>\n";
        print "<tr>\n";
        ?><td width="15%" style="background-color: #003366; color: white;">
                <input type="checkbox" name="Aselectall" class="Aselectall" id="Aselectall"/>
                <label class="cursor_pointer" id="Aselectall" for="Aselectall">Check all</label>
            </td>
            <td width="85%" style="background-color: #003366; color: white; text-align: center;"> Author name </td> 
                <?php
        print "</tr>\n";
        //create table
        $i = 0;
        while ($row = mysql_fetch_array($authors)) {
            $i++;
            $f_name = formatText_safe($row['first_name']);
            $l_name = formatText_safe($row['last_name']);
            print "<tr>\n";
            print "<td><input type=\"checkbox\" name=\"authors[]\" value=\"$row[member_id]\"></td>\n";
            echo "<input type='hidden' value=\"{$row['member_id']}\" />\n";
            echo "<td>{$f_name} {$l_name}</td>\n";

            echo "</tr>\n";
        }//end while
        print "</table>\n";
       
//populates the reviewers table with reviewers of this conference
    }
}
 } else {
     echo "no data";
 }
?>
